package com.geo.smallcredit.activity;


import com.geo.smallcredit.R;

import android.content.Context;
import android.os.CountDownTimer;
import android.widget.Button;

public class TimeCount extends CountDownTimer {
	
	private Context mContext;
	private Button btnVerify;
	
	public TimeCount(Context ctx, Button btn,long millisInFuture, long countDownInterval) {
		super(millisInFuture, countDownInterval);
		btnVerify = btn;
		mContext = ctx;
	}

	@Override
	public void onFinish() {
		btnVerify.setText(mContext.getString(R.string.login_register_verify_resend));
		btnVerify.setClickable(true);
		btnVerify.setEnabled(true);
//		btnVerify.setBackgroundResource(R.drawable.anniu_an);
	}

	@Override
	public void onTick(long millisUntilFinished) {
		btnVerify.setClickable(false);
		btnVerify.setEnabled(false);
		String strFormat = mContext.getString(R.string.login_register_verify_count);
		String strTxt = String.format(strFormat, millisUntilFinished / 1000);
		btnVerify.setText(strTxt);
	}
}
